package com.ian.config;

import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ReloadableResourceBundleMessageSource;

/**
 * 设置本地化
 * @author Witt
 * @version 1.0.0
 * @date 2022/5/10
 */
@Configuration
public class MessageSourceConfig {

    @Bean
    public MessageSource messageSource() {
        ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
//        messageSource.setBasename("classpath:org/springframework/security/messages/");
//        messageSource.addBasenames("classpath:org/springframework/security/messages/");
         messageSource.addBasenames("classpath:org/springframework/security/messages_zh_CN");
        return messageSource;
    }
}
